﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Drawing;

using DotSpatial.Topology;

using Point = System.Drawing.Point;

using System.Drawing.Drawing2D;

using System.Windows.Forms;





namespace FXnaGis
{

    /// <summary>
    /// 为图形的添加操作提供基础支持，可能的支持包括捕捉点，区域查询等算法,
    /// 对于扩展的应用，都可以再外部书写，包括事件等
    /// </summary>
    public class FAddGeometryMF:FMapFunction
    {

        public FAddGeometryMF(FMapFrame frame)
            : base(frame)
        {

            frame.LayerService.SelectedLayerChanged += new EventHandler(frame_SelectedLayerChanged);

            this._enabled = false;

        }


        protected FVectorLayer _currentLayer;

        void frame_SelectedLayerChanged(object sender, EventArgs e)
        {

            this._currentLayer = this._geoMapFrame.LayerService.SelectedLayer as FVectorLayer;



        }



        //这里由于是地理信息绘制，可能在绘制过程中存在缩放等问题，所以实际坐标会变化，不能存储屏幕坐标为依据

        protected List<Coordinate> _coordsInner = new List<Coordinate>();



        protected List<Point> _pts = new List<Point>();



        protected Point _mousePosition;




     


        protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
        {
            base.OnMouseUp(e);
        }


        protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            base.OnMouseMove(e);
        }




        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {

                this._coordsInner.Clear();

                this._geoMapFrame.Parent.Invalidate();


            }






        }



    }
}
